const mongoose = require('mongoose'),
    Schema = mongoose.Schema;

    let goodlistSchema = new Schema({
      name: String,
      price: Number,
      src: String,
      _id: false
    })


    let consumerqueueSchema = new Schema({
      openid: String,
      cost: Number,
      nickname: String,
      _id: false
    })

let storeSchema = new Schema({
    name: String,
    pic: String,
    openid: String,
    storied: String,
    t: {
      type: Number,
      default: 0.5
    },
    sum: {
      type: Number,
      default: 0
    },
    proxyPerson: {
      type: Number,
      default: 0
    },
    num: {
      type: Number,
      default: 0
    },
    cache: {
      type: Number,
      default: 0
    },
    wallet:{
      type: Number,
      default: 0
    },
    consumerqueue: [consumerqueueSchema],
    address: String,
    tel: String,
    feature: String,
    goodlist: [goodlistSchema],
    location: {
      longitude: '',  //经度
      latitude: ''    //维度
    }
}, {versionKey: false, timestamps: true});
module.exports = mongoose.model('store', storeSchema);
